# coding:utf-8

import os
import traceback

def  RedFile():
    try:
        path=os.getcwd()+'\\students.csv'
        file1 = open(path,mode='r',encoding='gbk')
        file1.readline()
        list1=file1.readlines()
        print(list1)
        namelist=[]
        age=0
        high=0
        for i in list1:
            name=i.split(',')
            age +=int(name[2])
            high +=int(name[3])
            if int(name[2])> 10:
                namelist.append(name[0])
        print('学生的平均年龄：%d'%(age/len(list1)))
        print('学生的平均身高：%d'%(high/len(list1)))
        print('年龄大于10岁的学生姓名:',namelist)
    except:
        traceback.print_exc()
    finally:
        file1.close()


if __name__ == '__main__':
    RedFile()
